using UnityEngine;
using System.Collections;

public class Bar : Item {
	
	public Material material;
	
	public Bar():base(){
	}
	
	public void starterate(Material mat){
		material = mat;
		if ((material.GetType()).ToString() == "Aluminum"){
			ItemList.aluminumBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Aluminum");
		} else if ((material.GetType()).ToString() == "Copper"){
			ItemList.copperBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Copper");
		} else if ((material.GetType()).ToString() == "Iron"){
			ItemList.ironBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Iron");
		} else if ((material.GetType()).ToString() == "Tin"){
			ItemList.tinBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Tin");
		} else if ((material.GetType()).ToString() == "Zinc"){
			ItemList.zincBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Zinc");
		} else if ((material.GetType()).ToString() == "Brass"){
			ItemList.brassBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Brass");
		} else if ((material.GetType()).ToString() == "Bronze"){
			ItemList.bronzeBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Bronze");
		} else if ((material.GetType()).ToString() == "Steel"){
			ItemList.steelBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/Steel");
		} else if ((material.GetType()).ToString() == "GalvanizedSteel"){
			ItemList.galvanizedSteelBars.Add(this);
			item.renderer.material = (UnityEngine.Material)UnityEngine.Resources.Load("Materials/GalvanizedSteel");
		} else {
			Debug.LogError (material.GetType());
		}
		ItemList.ironBars.Add(this);
		
	}
	
	// Use this for initialization
	void Start () {
		description = "This is a " + material.GetType().ToString() + " bar";
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public Material getMaterial(){
		return material;
	}
}
